from pydantic import BaseModel
from typing import List, Optional

class MenuPermission(BaseModel):
    id: str
    name: str
    path: str
    icon: Optional[str] = None
    permission: str
    children: List['MenuPermission'] = []

class UserPermissionResponse(BaseModel):
    user_id: str
    username: str
    is_superuser: bool
    menus: List[MenuPermission]
    permissions: List[str]  # 所有权限代码的扁平列表